<?php
/**
 * Created by PhpStorm.
 * User: zd
 * Date: 2019/1/24
 * Time: 10:56
 */

namespace app\api\validate;


use app\lib\exception\ParameterException;

class MemberParameter extends BaseValidate
{
    protected $rule=[
        'type'=>'require|checkType',
        'info'=>'require|checkInfo',
        'wu_id'=>'require|isPositiveInt',
    ];

    protected $message=[
        'wu_id'=>'用户ID必须为正整数',
    ];

    public function checkType($value){
        if ($value =='on' || $value=='off'){
            return true;
        }
        throw new ParameterException([
            'msg'=>'type参数不正确'
        ]);
    }

    public function checkInfo($value){
        if ($value =='ai' || $value=='boss'){
            return true;
        }
        throw new ParameterException([
            'msg'=>'info参数不正确'
        ]);

    }


}